home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 27 / 027.d81 / disk master (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  9KB  |  235 lines

  1. 210 clr:gosub 1980:dim d$(225),x$(225),u(225,2),b$(255):ft$="seqpgmusrrel"
  2. 220 d1=8    :rem - master  disk device#
  3. 230 d1$="0" :rem - master  disk drive#
  4. 240 d2=8    :rem - catalog disk device#
  5. 250 d2$="0" :rem - catalog disk drive#
  6. 260 bf=18   :rem - 39 for 8050 drives
  7. 270 :       :rem - 18 for all others
  8. 280 q$=chr$(34):close15:open15,d1,15:gosub2360
  9. 290 cx=2:gosub1990: print"reading directory cross reference"
  10. 300 close 5: open 5,d1,5,d1$+":disk mstr xref,s,r"
  11. 310 input#15,en,em$,et,es: if en=62 then 340
  12. 320 if en>0 then 2270
  13. 330 input#5,x$(nx),v:gosub 2260:u(nx,1)=v:u(v,2)=1:nx=nx+1:if ss=0 then330
  14. 340 close 5: cx=0: gosub 1980: print"     0 - done"
  15. 350 print"     1 - update master directory"
  16. 360 print"     2 - delete disk entry from master"
  17. 370 print"     3 - display selected directory"
  18. 380 print"     4 - list disk id's & names"
  19. 390 print"     5 - find specified file"
  20. 400 gosub 1990: print"enter desired function:  ";
  21. 410 gosub 1960: if c$="0" then print"[147]": goto 2330
  22. 420 v=val(c$): on v goto 430,960,1010,1140,1600: goto 410
  23. 430 cx=0: print"[147]      insert disk to be cataloged": close 5: close 15
  24. 440 if(d1<>d2)or(d1$<>d2$)thenprint"       in device#";d2;"  drive# ";d2$
  25. 450 print:gosub 1990:print"     press c[146] to catalog, q[146] to quit"
  26. 460 get c$: if c$="q" then gosub 2340: goto 340
  27. 470 if c$<>"c" then 460
  28. 480 gosub 1990:print"ok, reading bam ...":open 15,d2,15,"i"+d2$:gosub 2260
  29. 490 md=0: open 5,d2,5,"#0": gosub 2260: t=bf: s=0: gosub 2140
  30. 500 mf=144: if bf=18 then 560
  31. 510 mf=224: dn$="": for z=6 to 21: dn$=dn$+b$(z): next z
  32. 520 s$=b$(24): if b$(25)<>chr$(0) then s$=s$+b$(25)
  33. 530 df$=b$(27)+b$(28):nb=0: gosub 2130
  34. 540 for z=6 to 251 step 5: if z<>196 then nb=nb+asc(b$(z))
  35. 550 next z:gosub 2130:forz=6to 136 step5:nb=nb+asc(b$(z)):next z:goto 600
  36. 560 df$=b$(165)+b$(166):nb=0:forz=4to140step4:ifz<>72then nb=nb+asc(b$(z))
  37. 565 next z
  38. 570 ifasc(b$(3))=128thenforz=221to255:nb=nb+asc(b$(z)):nextz:df$=df$+"-ds"
  39. 580 dn$="": for z=144 to 159: dn$=dn$+b$(z): next z
  40. 590 s$=b$(162): if b$(163)<>chr$(0) then s$=s$+b$(163)
  41. 600 di$=left$(s$+"  ",2): u1=-1: u2=nx: if nx=0 then 680
  42. 610 c$=di$+dn$: for x=0 to nx-1: if c$<x$(x) then 670
  43. 620 ifc$<>x$(x)thennextx:goto680
  44. 630 u1=x:x=nx:next x:print"[147]*** warning ***[146]  this disk id: ";di$;"[146]"
  45. 640 print"disk name: ";dn$: print"is all ready cataloged.": gosub 1990
  46. 650 print"cataloging this disk":print"will delete the previous data!"
  47. 660 gosub 1990: print"ok to recatalog this disk";: gosub 2020: goto 690
  48. 670 u2=x:x=nx:next x
  49. 680 gosub2000
  50. 690 ifc$="n"then430
  51. 700 gosub 1990: print"reading directory entries ...": nf=0
  52. 710 t1=t: t=asc(b$(0)): s1=s: s=asc(b$(1)): if t=0 then 860
  53. 720 if t=t1 and s=s1 then 820
  54. 730 gosub 2140: for z=2 to 226 step 32: if (asc(b$(z)) and 7)=0 then 800
  55. 740 s$="": for x=3 to 18: s$=s$+b$(z+x): next x: if nf=0 then 770
  56. 750 p=0: for x=1 to nf: if s$<mid$(d$(x),2,16) then p=x: x=nf
  57. 760 next x: if p>0 then 780
  58. 770 p=nf+1: goto 790
  59. 780 for y=nf to p step -1: d$(y+1)=d$(y): next y
  60. 790 d$(p)=b$(z)+s$+b$(z+28)+b$(z+29): nf=nf+1
  61. 800 if nf<=mf then next z: goto 710
  62. 810 z=226: next z
  63. 820 print"[147]   *** disk directory is invalid ***[146]"
  64. 830 gosub 1990: print"   current disk cannot be cataloged!"
  65. 840 print"too many entries or non-standard format"
  66. 850 gosub 1940: goto 430
  67. 860 close 5: gosub 2340: gosub 1990: print"updating master directory ..."
  68. 870 if u1>-1 then x=u1: goto 920
  69. 880 x=u2: if x=nx then 900
  70. 890 for y=nx-1 to x step -1: x$(y+1)=x$(y): u(y+1,1)=u(y,1): next y
  71. 900 for y=0 to nx+1: if u(y,2)=1 then next y
  72. 910 u(y,2)=1: u(x,1)=y: x$(x)=di$+dn$: nx=nx+1: y=nx: next y
  73. 920 gosub 1840: print#15,"s"+s$: open 5,d1,5,s$+",s,w": gosub 2260
  74. 930 print#5,df$;",";nb: gosub 2260: if nf=0 then 950
  75. 940 for x=1 to nf: print#5,d$(x): gosub 2260: next x
  76. 950 close 5: cx=1: gosub 2180: goto 430
  77. 960 print"[147]to delete disk from master directory"
  78. 970 gosub 1730: on v goto 1000,960
  79. 980 cx=1: print#15,"s"+s$: y=u(x,1): u(y,2)=0: for y=x to nx-1
  80. 990 x$(y)=x$(y+1): u(y,1)=u(y+1,1): next y: nx=nx-1: goto 960
  81. 1000 gosub 2180: goto 340
  82. 1010 print"[147]to display disk directory": gosub 1730: on v goto 340,1010
  83. 1020 gosub 2170: gosub 1880: nf=0: print#4,"  disk name:  ";dn$
  84. 1030 print#4,"    disk id:  ";di$;spc(8);"format:  ";df$
  85. 1040 print#4,"blocks free: ";nb
  86. 1050 print#4,"---------------------------------------": if ss>0 then 1120
  87. 1060 gosub 2050: print#4,right$("    "+str$(x1+(256*x2)),4);"  ";s$;"   ";
  88. 1070 v=(ft and 7)*3-2: print#4,mid$(ft$,v,3);
  89. 1080 if (ft and 128)=0 then print#4,"  (open)";
  90. 1090 if ft>=193 then print#4,"  (locked)";
  91. 1100 print#4: gosub 1910: if c$="q" then 1130
  92. 1110 nf=nf+1: if ss=0 then 1060
  93. 1120 print#4: print#4,"#files: ";nf: gosub 1930
  94. 1130 close 4: close 5: goto 1010
  95. 1140 if nx=0 then gosub 1730: goto 340
  96. 1150 gosub 1980: print "     0 - return to main function menu"
  97. 1160 print"     1 - list full id useage chart"
  98. 1170 print"     2 - quick list of id's in use"
  99. 1180 print"     3 - list disk id's & names"
  100. 1190 print"     4 - list min[146] free blocks per disk"
  101. 1200 print"     5 - list max[146] free blocks per disk"
  102. 1210 gosub 1990: print"enter desired function:  ";
  103. 1220 gosub 1960: if c$="0" then 340
  104. 1230 v=val(c$): if v<1 or v>5 then 1220
  105. 1240 print c$: on v goto 1250,1380,1450,1470,1500
  106. 1250 gosub 1880: gosub 2400: z=0: for x=48 to 90: if x=58 then x=65
  107. 1260 if pd=4 or x<>73 then 1300
  108. 1270 gosub 1990: print"  press any key to continue, q[146] to quit"
  109. 1280 gosub 1960: if c$="q" then x=9999: next x: goto 1150
  110. 1290 print"[147]";: gosub 2400
  111. 1300 print#4,chr$(x);" ";: for y=48 to 90: if y=58 then y=65
  112. 1310 if z=nx then 1360
  113. 1320 for v=1 to 2: f$=mid$(x$(z),v,1): if f$>="0" and f$<="9" then 1340
  114. 1330 if f$<"a" or f$>"z" then z=z+1: v=2: next v: goto 1310
  115. 1340 next v: c$=chr$(x)+chr$(y): s$=left$(x$(z),2)
  116. 1350 if s$=c$ then print#4,"*";: z=z+1: goto 1370
  117. 1360 print#4,".";
  118. 1370 next y: print#4: goto 1580
  119. 1380 gosub 1880: print#4,""spc(7);"disk id's currently in use"
  120. 1390 print#4: v=12: if pd=4 then v=25
  121. 1400 z=0: for x=0 to nx-1: c$=left$(x$(x),2)
  122. 1410 if x<nx-1 then if c$=left$(x$(x+1),2) then 1430
  123. 1420 print#4,c$;" ";: z=z+1:
  124. 1430 next x: print#4: if z<>int(z/v)*v then print#4
  125. 1440 print#4,z;"id's,";nx;"disks cataloged":print#4:gosub 1930:goto 1150
  126. 1450 gosub 1880: gosub 2430
  127. 1460 for x=0 to nx-1: print#4,left$(x$(x),2);"  ";mid$(x$(x),3): goto 1580
  128. 1470 gosub 1990: print"enter minimum number of free blocks"
  129. 1480 input"to be displayed0[157][157][157]";s$: vf=0: y=0: if s$="0" then 1530
  130. 1490 goto 1520
  131. 1500 gosub 1990: print"enter maximum number of free blocks"
  132. 1510 input"to be displayed99[157][157][157][157]";s$: vf=1
  133. 1520 y=val(s$): if y=0 then 1150
  134. 1530 gosub 1880: print#4,"#blks free  ";: gosub 2430
  135. 1540 for x=0 to nx-1: gosub 1830: gosub 2170: close 5
  136. 1550 if (vf=0) then if (nb<=y) then 1580
  137. 1560 if (vf=1) then if (nb>=y) then 1580
  138. 1570 print#4,right$("       "+str$(nb),7);spc(5);di$;"  ";dn$
  139. 1580 gosub 1910: if c$="q" then x=9999: next x: goto 1150
  140. 1590 next x: print: gosub 1930: goto 1150
  141. 1600 if nx=0 then gosub 1730:goto 340
  142. 1610 close 4:print"[147]to find what disk(s) a file is on"
  143. 1620 input"enter file name.[157][157][157]";f$: if f$="." then 340
  144. 1630 if f$="*" then print: print"re-";: goto 1620
  145. 1640 s$=f$: gosub 1850: v=y: gosub 1880
  146. 1650 print#4,"...file name....  ";: gosub 2430
  147. 1660 print#4,s$: print#4: for x=0 to nx-1: gosub 1830: gosub 2170
  148. 1670 gosub 2050: if f$<left$(s$,v) then 1710
  149. 1680 if f$=left$(s$,v) then print#4,s$;"  ";di$;"  ";dn$
  150. 1690 gosub 1910: if c$="q" then close 5: x=nx: next x: goto 1610
  151. 1700 if ss=0 then 1670
  152. 1710 close 5: next x: print: gosub 1930: goto 1610
  153. 1720 rem *****   subroutines   *****
  154. 1730 v=3:if nx=0 then print"[147]no entries";: v=1: goto 1820
  155. 1740 input"enter disk name.[157][157][157]";f$: if f$="." then 1760
  156. 1750 gosub 1850: z=3: goto 1780
  157. 1760 input"enter disk id.[157][157][157]";f$: if f$="." then v=1: return
  158. 1770 f$=left$(f$+"  ",2): y=2: z=1
  159. 1780 for x=0 to nx-1: if y>0 then if f$<>mid$(x$(x),z,y) then 1800
  160. 1790 gosub 1830: gosub 2000: if c$="y" then z=x: x=nx: next x: x=z: return
  161. 1800 next x
  162. 1810 print"not";: v=2
  163. 1820 print" in master directory!": goto 1940
  164.